Socket
Socket
Sign inDemoInstall

emotion

Package Overview
Dependencies
Maintainers
4
Versions
144
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emotion

The Next Generation of CSS-in-JS.


Version published
Weekly downloads
641K
increased by12.22%
Maintainers
4
Weekly downloads
 
Created

What is emotion?

Emotion is a performant and flexible CSS-in-JS library that allows you to style applications quickly and efficiently with JavaScript. It provides powerful and flexible tools for writing CSS styles with JavaScript, including support for styled components, CSS prop, and keyframes for animations.

What are emotion's main functionalities?

Styled Components

Styled components allow you to create React components with styles attached to them. This makes it easy to manage styles in a modular and reusable way.

const Button = styled.button`
  color: hotpink;
`;

<Button>Click me</Button>

CSS Prop

The CSS prop allows you to style elements using a prop directly in your JSX. This is useful for applying styles conditionally or dynamically.

<div css={{ color: 'hotpink' }}>Hello World</div>

Keyframes for Animations

Emotion provides support for keyframes, allowing you to define animations in your JavaScript code. This makes it easy to create complex animations and apply them to your components.

import { keyframes } from '@emotion/react';

const bounce = keyframes`
  from, 20%, 53%, 80%, to {
    transform: translate3d(0,0,0);
  }
  40%, 43% {
    transform: translate3d(0, -30px, 0);
  }
  70% {
    transform: translate3d(0, -15px, 0);
  }
  90% {
    transform: translate3d(0,-4px,0);
  }
`;

const BouncingDiv = styled.div`
  animation: ${bounce} 1s ease infinite;
`;

<BouncingDiv>Bounce!</BouncingDiv>

Other packages similar to emotion

Keywords

FAQs

Package last updated on 22 Dec 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc